<div class="contents">
  <ol class="breadcrumb">
    <li><a href="#/index/panel">首页</a></li>
     <li>{{m|orderListTitleRender}}</li>
      <div ng-if="((m=='01'&&role!='cp')||(role!='cpm'&&m=='05')||(role=='cp'&&m=='09')||(role=='cpm'&&m=='09'))&&role!='cwa'" ng-click="changeShow()" id="changecss" class="markyanse" style="filter: glow(color=black,strength=3); height:10px;  padding:1px;float:right;">消息({{orderList.length}})</div>
  </ol>
  <form class="form-inline search-box" role="form" ng-submit="search()" novalidate>
      <!--  不支持排序
  <a ng-if="!(m=='09'||m=='08'||m=='04')" style="padding-left:100px;font-size:20px"  ng-click="changeStatus(key)" ng-repeat="(key, value) in statusMap">{{key|orderStatusToNameRender}}({{value}})</a>
-->
<!-- 需要排序   -->
  <div ng-if="!(m=='09')" >
     <a ng-if="(statusMap[m.value]>=0)" style="padding-left:20px;font-size:16px;color:{{orderStatusSelected==m.value?'red':'black'}}" ng-click="changeStatus(m.value)" ng-repeat="m in dictMap.orderStatusToNameModel">
        {{m.text}} ({{statusMap[m.value]}})
      </a>
 </div>
     <div class="form-group" style="display:table;padding-top:20px" >
      <label style="float:left;width:50px;">
        <input type="checkbox" name="ptype" value="02" ng-click="changeProductType();">信托
      </label>
      <label style="float:left;width:50px;">
        <input type="checkbox" name="ptype" value="03" ng-click="changeProductType();">资管
      </label>

      <label style="float:left;width:100px;">
        <input type="checkbox" name="ptype" value="07" ng-click="changeProductType();">债权基金
      </label>
      <label style="float:left;width:100px;">
        <input type="checkbox" name="ptype" value="06" ng-click="changeProductType();">股权基金
      </label>
    </div>
    <div class="form-group">
      <input style="width:400px" class="form-control" placeholder="{{(role=='qd'||role=='qdm')?'输入产品名称/理财师手机号/客户名字/订单号':((role=='cp'||role=='cpm')?'输入产品名称/客户名字/订单号/订单ID':'订单ID/订单号/产品名称/客户姓名/理财师手机号')}}" name="searchCriteria" ng-model="searchMap.searchCriteria" style="width:130px;"></input> 
<!--
    </div>
     <div ng-if="role=='cwa'||role=='cwam'" class="form-group">
      <input class="form-control" placeholder="产品名称" name="oPName" ng-model="searchMap.oPName" style="width:330px;"></input> 
    </div>

    <div class="form-group">
      <input class="form-control" placeholder="订单ID" name="id" ng-model="searchMap.id" style="width:130px;"></input> 
    </div>
    <div class="form-group">
      <input class="form-control" placeholder="订单编号" name="oCode" ng-model="searchMap.oCode" style="width:220px;"></input> 
    </div>
    <div class="form-group">
      <input class="form-control" placeholder="理财师手机号码" name="oULoginName" ng-model="searchMap.oULoginName" ></input> 
    </div>
    -->
    <div ng-if="!(role=='cp'&&m=='01')" class="form-group">
      <select  class="form-control" placeholder="产品负责人" ng-model="searchMap.oManagerName" ng-options="m.userNickname as m.userNickname for m in productCreatByList" >
        <option value="">--产品负责人--</option>
      </select>     
    </div>

   <div ng-if="(role=='cp')||(m=='09'&&role=='cpm')||(m=='05'||m=='07')" class="form-group">
      <select  class="form-control" placeholder="订单跟进人" ng-model="searchMap.oFlowerName" ng-options="u.username as u.username for u in orderManagerUserList" >
        <option value="">--订单跟进人--</option>
      </select> 
    </div>    
    <div class="form-group">
      <select class="form-control" placeholder="是否包销" ng-model="searchMap.flagBaoxiao">
        <option value="">--选择是否包销--</option>
        <option value="true">是</option>
        <option value="false">否</option>
      </select>
    </div>

    <div class="form-group">
      <select class="form-control" placeholder="是否提交审核" ng-model="searchMap.flagOrderDataCheck">
        <option value="">--是否提交审核--</option>
        <option value="true">否</option>
      </select>
    </div>
<!--  
    
    <div ng-if="role=='cwa'&&m=='05'" class="form-group">
      <select class="form-control" placeholder="订单状态" ng-model="searchMap.oStatus" ng-options="m.value as m.text for m in dictMap.umcompleteCWOrderStatusModel" ><option value="">--选择订单状态--</option></select> 
    </div>   
    <div ng-if="(role == 'cp' && m=='01')||(m=='05' && role=='cpm')" class="form-group">
      <select class="form-control" placeholder="订单状态" ng-model="searchMap.oStatus" ng-options="m.value as m.text for m in dictMap.umcompleteOrderStatusModel" ><option value="">--选择订单状态--</option></select> 
    </div>

    <div ng-if="m==02||m==06" class="form-group">
      <select class="form-control" placeholder="订单状态" ng-model="searchMap.oStatus" ng-options="m.value as m.text for m in dictMap.effectiveOrderStatusModel" ><option value="">--选择订单状态--</option></select> 
    </div>

    <div ng-if="m==03||m==07" class="form-group">
      <select class="form-control" placeholder="订单状态" ng-model="searchMap.oBackStatus" ng-options="m.value as m.text for m in dictMap.backOrderStatusModel" ><option value="">--选择订单状态--</option></select> 
    </div>

    <div ng-if="m==09" class="form-group">
      <select class="form-control" placeholder="订单状态" ng-model="searchMap.oStatus">
        <option value="">--选择订单状态--</option>
        <option value="120">成交价待审核</option>
      </select>
    </div>
    -->
    <div class="form-group">
      <label>预约日期</label>
      <input type="date" class="form-control" placeholder="开始日期,如2015-01-01" ng-model="searchMap.createDateStart" maxlength="10" title="预约开始日期">
    </div>至 
    <div class="form-group">
      <input type="date" class="form-control" placeholder="结束日期,如2015-01-01" ng-model="searchMap.createDateEnd" maxlength="10" title="预约结束日期">
    </div>
    <div ng-if="role=='cwa'||role=='cp'||role=='cpm'" class="form-group">
      <div class="form-group">
        <label>财务打款日期</label>
        <input type="date" class="form-control" placeholder="开始日期,如2015-01-01" ng-model="searchMap.flowCreateDateStart" maxlength="10" title="财务打款开始日期">
      </div>至 
      <div class="form-group">
        <input type="date" class="form-control" placeholder="结束日期,如2015-01-01" ng-model="searchMap.flowCreateDateEnd" maxlength="10" title="财务打款结束日期">
      </div>
    </div>
    <div class="form-group">
      <select class="form-control" placeholder="订单来源媒体" ng-model="searchMap.oMediaSource" ng-options="m.value as m.text for m in dictMap.mediaSourceModel" ><option value="">--选择订单来源媒体--</option></select> 
    </div> 
    <button type="submit" class="btn btn-default">查询</button>
    <button ng-if="(m=='05'&&role=='qdm')||(role=='cp'&&m=='09')" type="button" class="btn btn-primary" style="margin-left:10px;" ng-click="orderDoOrder(1);" has-auth where="btn" who="ORDER_MANAGER_USER_LIST">分配</button>
    <button ng-if="(m=='05'&&role=='qdm')||(role=='cp'&&m=='09')" type="button" class="btn btn-primary" style="margin-left:10px;" ng-click="orderDoOrder(0);" has-auth where="btn" who="ORDER_MANAGER_USER_LIST">收回</button>
  </form>
  <table class="table table-striped table-hover">
    <thead>
      <tr>
        <th width="30"><input type="checkbox" id="chkAllOrderList" ng-click="chkAllOrderList();" /></th>
        <th width="100px">媒体来源</th>
        <th width="60px">订单号</th>
        <th width="80px">产品简称</th>
        <th width="80px">是否包销</th>
        <th width="80px">订单金额</th>
        <th width="60px">客户姓名</th>
        <th width="50px">理财师ID</th>
        <th width="115px">预约时间</th>
        <th width="80px" ng-if="role=='cp'||role=='cpm'">产品经理</th>
        <th width="80px" ng-if="role=='qd'||role=='qdm'||role=='cwa'||role=='cwam'">渠道</th>
        <th width="100px" ng-if="m=='01'||m=='05'||m=='09'">状态</th>
        <th width="100px" ng-if="m=='03'||m=='07'||m=='09'">后端状态</th>
        <th width="110px" ng-if="m!=03&&m!=07">报单</th>
        <th width="110px" ng-if="m!=03&&m!=07">合同</th>
        <th width="90px">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="item in list">
        <td>
          <input type="checkbox" name="chkOrderList" value="{{item.id}}" faid="{{item.oFAId}}" omu="{{item.oFlowerName}}" />
        </td>
        <td>{{item.oMediaSource}}</td>
        <td><a ng-click="toViewPage(item.id,item.oPType,'/neworder/neworder0815/base')" href="javascript:">{{item.oCode}}</a></td>
        
        <td>
          <!--
            <a ng-click="changeClickNone('#/product/qudaoView?id='+item.oProjectId,'9999'+item.oPType+item.oProjectId,item.oPName)" href="javascript:;"></a>
            -->
            {{item.oPName}}
        </td>
        <td>{{item.flagBaoxiao?"是":"否"}}</td>
        <td>{{item.oAmount | moneyRender2}}</td>
        <td>{{item.oCName}}</td>
        <td><a href="#/fa/view?id={{item.oFAId}}">{{item.oFAId}}</a></td>
        <td>{{item.createDate | date:'yyyy-MM-dd HH:mm'}}</td>
        <td ng-if="role=='cp'||role=='cpm'">{{item.oManagerName}}</td>
        <td ng-if="role=='qd'||role=='qdm'||role=='cwa'||role=='cwam'">{{item.oFlowerName}}</td>

        <td class="optd order-status-{{item.oStatus}}" ng-if="m=='01'||m=='05'||m=='09'">
          {{item.oStatus | orderStatusRender}}
          <br>
          <a ng-if="item.backApplyStatus&&(role=='qdm'||role=='qd')&&(!item.oBackStatus||item.oBackStatus=='231'||item.oBackStatus=='361'||item.oBackStatus=='331')"  ng-click="toViewPage(item.id,item.oPType,'/neworder/neworder0815/base?paramTabUrl=orderUrl&hdjy=true')" href="javascript:">申请后端结佣</a>
        </td>

          <td ng-if="m=='03'||m=='07'||m=='09'" class="order-status-{{item.oBackStatus}}">{{item.oBackStatus | orderStatusRender}}</td>

        <td class="optd" ng-if="m!=03&&m!=07">
          {{item.phoFlag | oPhoStatusView}}<br/>
          <!-- 审核中  审核通过不允许报单 -->
          <a ng-if="(role=='qd'||role=='qdm')&&item.oStatus>'110'&&item.oStatus!='140'&&item.oStatus!='888'&&item.oStatus!='999'&&item.oStatus<'360'&&item.phoFlag!='03'" ng-click="toUploadPage(item.oProjectId, item.id, item.oPType, item.oPType,'order/phoUpload')" href="javascript:" has-auth where="btn" who="PEVC_ORDER_EDIT" class="cur-p">{{item.phoFlag=='04'?"重新":""}}报单</a>
          <!-- 审核中  审核通过  才查看订单 -->
           <a ng-if="(role=='qd'||role=='qdm'||role=='cp'||role=='cpm')&&item.oStatus>'110'&&item.oStatus!='140'&&item.oStatus!='888'&&item.oStatus!='999'&&(item.phoFlag=='03')" ng-click="toUploadPage(item.oProjectId, item.id, item.oPType, item.oPType,'order/phoUpload')" href="javascript:" has-auth where="btn" who="PEVC_ORDER_EDIT" class="cur-p">报单查看</a>

           <a ng-if="(role=='cp'||role=='cpm')&&item.oStatus>'110'&&item.oStatus!='140'&&item.oStatus!='888'&&item.oStatus!='999'&&item.phoFlag!='01'&&item.phoFlag!='03'" ng-click="toUploadPage(item.oProjectId, item.id, item.oPType, item.oPType, 'productOrderData/edit')" href="javascript:" has-auth where="btn" who="PEVC_ORDER_EDIT" class="cur-p" >报单审核</a>
          
        </td>
        <td class="optd" ng-if="m!=03&&m!=07">
         <span> {{item.contractStatus|contractStatusRender}}</span>
     <!--     <span ng-if="!((item.contractStatus=='01'||item.contractStatus=='03')&&(role=='qd'||role=='qdm'))&&!((item.contractStatus=='02'||item.contractStatus=='04')&&(role=='cp'||role=='cpm'))&&item.contractStatus!='05'">
            {{item.contractStatus|contractStatusRender}}
          </span>
          -->
          <br/>
           <span ng-if="item.contractStatus=='05'||((item.contractStatus=='02'||item.contractStatus=='04')&&(role=='cp'||role=='cpm'))||((item.contractStatus=='01'||item.contractStatus=='03')&&(role=='qd'||role=='qdm'))&&item.oStatus>'110'&&item.oStatus!='140'&&item.oStatus!='888'&&item.oStatus!='999'">
           <a ng-click="toViewPage(item.id,item.oPType,'/neworder/neworder0815/base?paramTabUrl=contractUrl')" href="javascript:"> {{item.contractStatus|contractStatusMKRender}}</a>
          </span>
        </td>
        <td class="optd">
         <a ng-click="toViewPage(item.id,item.oPType,'/neworder/neworder0815/base')" href="javascript:">编辑</a>
     <!--      
          <a ng-if="(role=='cp'||role=='cpm')&&m=='09'" ng-click="isInvestigateYes(item.id)" href="javascript:">通过</a>
          <a ng-if="(role=='cp'||role=='cpm')&&m=='09'" ng-click="isInvestigateNo(item.id)" href="javascript:">不通过</a>
          -->
        </td>
      </tr>
    <tbody>
  </table> 

  <div class="pager-box" ng-include src="'tpl/public/pager.html'" ng-show="list.length > 0"></div>
</div>
<div class="layer-box" ng-show="isShowOrderManagerLayer">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="isShowOrderManagerLayer = false;">X</span>
    <div class="layer-title">
      <label ng-if="t == '1'">分配！请确认操作！</label>
      <label ng-if="t == '0'">回收！请确认操作！</label>
    </div>
    <div class="con-wrap">
      <div class="form-group">
        <table class="order-f-h" style="width:100%">
          <tr ng-if="t == '1'">
            <td colspan="2">
              <select class="form-control" ng-model="managerOrder.systemUserId" ng-options="u.userId as u.username for u in orderManagerUserList">
              </select>
            </td>
          </tr>
          <tr>
            <td colspan="2" style="text-align:left;font-weight: bold;">共选择{{chooseOrderIdCount}}条订单！</td>
          </tr>
          <tr>
            <td><a class="btn btn-block btn-primary" ng-click="fenpeiOrHuishou(t);">确定</a></td>
            <td><a class="btn btn-block btn-primary" ng-click="isShowOrderManagerLayer = false;">取消</a></td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>

<div class="layer-box" ng-show="isShowOrder"  >
  <div class="layer-bg"></div>

  <div class="layer-con " style="padding:10px 20px; width:440px;height:335px;">
    <span class="icons-close" title="关闭" ng-click="isShowOrder = false;">X</span>
    <div class="layer-title">
      <label >订单情况</label>
    </div>
    <div style="padding:10px 20px; width:400px;height:300px;overflow: scroll">
    
    <div class="con-wrap">
      <div class="form-group" >

<div ng-if="orderList==''">
<table class="order-f-h ziliaoshangchuan" style="width:100%">
          <tr >
            <td >
              序号
            </td>
            <td >
              订单号
            </td>
            <td >
              当前状态
            </td>
            <td >
              停留天数
            </td>
          </tr>

          
        </table>


  无订单记录
</div>
<div ng-if="orderList.length>0">
        <table class="order-f-h ziliaoshangchuan" style="width:100%">
          <tr >
            <td >
              序号
            </td>
            <td >
              订单号
            </td>
            <td >
              当前状态
            </td>
            <td >
              停留天数
            </td>
          </tr>
          <tr ng-repeat="order in orderList">
            <td >
            {{$index+1}}
            </td>
            <td >
              {{order.o_code}}
            </td>
            <td >
              {{order.o_status}}
            </td>
            <td >
              {{order.dateDiffnow}}
            </td>
            
          </tr>
          
        </table>
        <div >
      </div>
    </div>
    </div>
  </div>
</div> 
